Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add v2v case about virt-v2v-in-place #5896

Merged
merged 1 commit into from
Sep 14, 2024

Conversation

mxie91
Copy link
Contributor

@mxie91 mxie91 commented Sep 12, 2024

No description provided.

@mxie91
Copy link
Contributor Author

mxie91 commented Sep 12, 2024

@xiaodwan pls review, thanks

avocado run --vt-type v2v convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.none

JOB ID : 83a66850d3a34143723ccf90881266ed3dab9826
JOB LOG : /root/avocado/job-results/job-2024-09-12T03.40-83a6685/job.log
(1/1) type_specific.io-github-autotest-libvirt.convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.none: STARTED
(1/1) type_specific.io-github-autotest-libvirt.convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.none: PASS (226.31 s)
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML : /root/avocado/job-results/job-2024-09-12T03.40-83a6685/results.html
JOB TIME : 230.20 s

elif checkpoint == 'virt_v2v_in_place':
v2v_params.update({'new_name': ''})
v2v_result = utils_v2v.cmd_run(str(utils_v2v.v2v_cmd(v2v_params, cmd_only=True)).
replace('/usr/bin/virt-v2v', '/usr/libexec/virt-v2v-in-place').
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think process.run can be used here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to use check log function of v2v_result to check expect_msg

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2v.cmd_run also calls process.run. You can check the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand, I need to use log_check = utils_v2v.check_log(params, output) of functiion check_result(result, status_error to check msg_content = 'virt-v2v-in-place: warning:...“

If I used process.run to run virt-v2v-in-place command, I need to write another code to check msg_content, which is unnecessary things

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Convert the result process.run to string and save it to 'output', you can then use utils_v2v.check_log(params, output) to do the check.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything wrong with the method I am using now? Why is it better to use process.run?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is not tidy. For the maintainers, it's hard to understand.

@mxie91 mxie91 force-pushed the add-case-for-virt-v2v-in-place branch from 3d87a04 to 390390c Compare September 13, 2024 02:21
@mxie91
Copy link
Contributor Author

mxie91 commented Sep 13, 2024

@xiaodwan updated codes according your suggestions, pls review, thanks!

avocado run --vt-type v2v convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.none

JOB ID : fda97c2c8044fdc7040bac9e80a01f796d5d924c
JOB LOG : /root/avocado/job-results/job-2024-09-12T10.12-fda97c2/job.log
(1/1) type_specific.io-github-autotest-libvirt.convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.none: STARTED
(1/1) type_specific.io-github-autotest-libvirt.convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.none: ERROR: local variable 'v2v_result' referenced before assignment (220.90 s)
RESULTS : PASS 0 | ERROR 1 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML : /root/avocado/job-results/job-2024-09-12T10.12-fda97c2/results.html
JOB TIME : 223.82 s

@mxie91
Copy link
Contributor Author

mxie91 commented Sep 13, 2024

Correct test result of last comment:

avocado run --vt-type v2v convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.none

JOB ID : a4f6c6af809abaf58b7c17f9d98e3b47634dc0bb
JOB LOG : /root/avocado/job-results/job-2024-09-12T10.19-a4f6c6a/job.log
(1/1) type_specific.io-github-autotest-libvirt.convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.none: STARTED
(1/1) type_specific.io-github-autotest-libvirt.convert_from_file.positive_test.linux.input_mode.disk.virt_v2v_in_place.output_mode.none: PASS (341.74 s)
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML : /root/avocado/job-results/job-2024-09-12T10.19-a4f6c6a/results.html
JOB TIME : 344.69 s

@@ -288,6 +288,12 @@ def vm_check():
log_fail('fail to download guest image from libvirt-ci resource')
image_name = re.search(r'RHEL-\S*\w*.qcow2', params.get('image_url')).group()
v2v_params.update({'input_file': os.path.join(tmp_path, image_name)})
if checkpoint == 'virt_v2v_in_place':
output = utils_v2v.cmd_run('/usr/libexec/virt-v2v-in-place -i disk %s/%s' % (tmp_path, image_name),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the real disk path needed here? Can we use a fake disk path? I think this is a negative scenario, it will report the error no matter what the disk path is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What 'v2v_dirty_resources' should be cleaned? If no, process.run is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not a negative scenario, virt-v2v-in-place must convert a guest from a real disk and the expected virt-v2v-in-place warning only shows in a successful conversion!

@@ -331,8 +337,10 @@ def vm_check():

if 'new_name' in v2v_params:
vm_name = params['main_vm'] = v2v_params['new_name']

check_result(v2v_result, status_error)
if checkpoint == 'virt_v2v_in_place':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if checkpoint != 'xxx':
check_result(v2v_result, status_error)

@mxie91 mxie91 force-pushed the add-case-for-virt-v2v-in-place branch from 390390c to 960f6c0 Compare September 13, 2024 08:27
@xiaodwan xiaodwan merged commit ad9830b into autotest:master Sep 14, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants